package com.lixin.smartclassroom.ui.home.tab1.activity

import com.drake.brv.utils.bindingAdapter
import com.drake.net.utils.scopeNetLife
import com.lixin.smartclassroom.api.classhistorylist
import com.lixin.smartclassroom.api.getclassnews
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.FragmentRecyclerCustomBinding
import com.lixin.smartclassroom.ui.home.adapter.abnormalTotal
import com.lixin.smartclassroom.ui.home.adapter.teacherSendMessage
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.getIntentString
import com.lixinkeji.extension.gone
import com.lixinkeji.extension.visible

/**
 * Description 老师发送的通知
 * Author: lwc
 * Date:2023/12/7 15:53
 */
class TeacherSendMessageAct : BaseActivity<FragmentRecyclerCustomBinding>() {
    override fun getViewBinding() = FragmentRecyclerCustomBinding.inflate(layoutInflater)

    override fun topBarHide() = false
    override fun startPadding() = true
    private lateinit var listBean: ArrayList<DataListBean>
    private var fromType = ""
    private var classid = ""
    override fun title(): String {
        fromType = getIntentString("type")
        classid = getIntentString("classid")
        when (fromType) {
            "1" -> return "消息通知"
            "2" -> return "历史通知"
        }
        return ""
    }

    override fun iniView() {
        binding.recycler.teacherSendMessage()

        binding.apply {
            refresh.onRefresh {
                scopeNetLife {
                    listBean = classhistorylist(classid,index, 10)!!
                    addData(listBean) {
                        if (binding.recycler.bindingAdapter.models?.size == 0) {
                            binding.state.showEmpty()
                            binding.recycler.gone()
                        } else {
                            binding.recycler.visible()
                        }
                        listBean.size == 10
                    }
                }
            }.autoRefresh()
        }
    }



}